package com.yxh.www.author.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统第三方授权信息
 * </p>
 *
 * @author Yangxiaohui
 * @since 2020-05-09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@NoArgsConstructor
public class SmAccount extends Model<SmAccount> {

    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    /**
     * 账户名
     */
    @TableField("account_name")
    private String accountName;

    /**
     * 秘钥
     */
    @TableField("secret_key")
    private String secretKey;

    /**
     * 账户状态（0：正常；1：失效）
     */
    @TableField("account_status")
    private String accountStatus;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 有效域
     */
    @TableField("scope_ip")
    private String scopeIp;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private String userId;

    public SmAccount(String accountName, String remark, String scopeIp, String userId) {
        this.accountName = accountName;
        this.remark = remark;
        this.scopeIp = scopeIp;
        this.userId = userId;
    }

    public SmAccount(String id, String accountName, String accountStatus, String remark, String scopeIp) {
        this.id = id;
        this.accountName = accountName;
        this.accountStatus = accountStatus;
        this.remark = remark;
        this.scopeIp = scopeIp;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
